﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="hoangnam12._Default" %>
    <%@Register Assembly="CollectionPager" Namespace="SiteUtils" TagPrefix="cc1" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="NamHolder">
    <tr>
        <td>
            <p style="font-weight: 700; font-size: large; color: #0066FF">
                S&#7843;n Ph&#7849;m Bán Ch&#7841;y Nh&#7845;t :
            </p>
            <asp:DataList ID="DataList1" runat="server"  RepeatColumns="2" DataSourceID = "SqlDataSource1"
                Style="margin-left: 0px" CellSpacing="20" OnSelectedIndexChanged="DataList1_SelectedIndexChanged"
                OnItemCommand="DataList1_ItemCommand" DataKeyField="MaSP">
                <ItemTemplate>
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                <asp:Image ID="Image1" runat="server" Height="319px" Width="354px" ImageUrl='<%# Eval("HinhSP") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("TenSP") %>' NavigateUrl = '<%# "ChitietSP.aspx?ID=" + Eval("MaSP") %>'
                                    ForeColor="#0066FF"></asp:HyperLink>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <span style="color: #0066FF"><strong>Giá:</strong></span>
                                <asp:Label ID="GiaSPLabel" runat="server" Text='<%# Eval("GiaSP") %>' Style="font-weight: 700;
                                    color: #0066FF" />
                                &nbsp;<span style="color: #0066FF"><strong>vn&#273;</strong></span>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/icon-mua-hang.png"
                                    CommandArgument='<%# Eval("MaSP") %>' OnClick="ImageButton1_Click" CommandName="Chonmua" />
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:QLBHConnectionString %>"
                SelectCommand="SELECT  [MaSP], [TenSP], [GiaSP], [HinhSP] FROM [SanPham] where MaSP in (select top 2 MaSP from ChiTietHoaDon group by MASP order by COUNT(MaSP))  ">
            </asp:SqlDataSource >
            
        </td>
    </tr>
    <tr>
        <td>
            <p style="font-weight: 700; font-size: large; color: #0066FF">
                S&#7843;n Ph&#7849;m M&#7899;i Nh&#7853;p :
            </p>
            <p style="font-weight: 700; font-size: large; color: #0066FF">
                <asp:DataList ID="DataList2" runat="server" DataKeyField="MaSP" 
                    RepeatColumns="2" CellSpacing="20" onitemcommand="DataList2_ItemCommand">
                    <ItemTemplate>
                        <table style="width: 100%;">
                            <tr>
                                <td>
                                    <asp:Image ID="Image1" runat="server" Height="319px" Width="354px" ImageUrl='<%# Bind("HinhSP") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Bind("TenSP") %>'  
                                    ForeColor="#0066FF" NavigateUrl = '<%# "ChitietSP.aspx?ID=" + Eval("MaSP") %>'></asp:HyperLink>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <span style="color: #0066FF"><strong>Giá:</strong></span>
                                    <asp:Label ID="GiaSPLabel" runat="server" Text='<%# Bind("GiaSP") %>' Style="font-weight: 700;
                                        color: #0066FF" />
                                    &nbsp;<span style="color: #0066FF"><strong>vn&#273;</strong></span>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/icon-mua-hang.png"
                                        CommandArgument='<%# Bind("MaSP") %>'  CommandName="Chonmua" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:QLBHConnectionString %>"
                    SelectCommand="SELECT top 6 [MaSP], [TenSP], [GiaSP], [SoLuongSP], [HinhSP] FROM [SanPham] order by [NgayNhap] desc ">
                    
                </asp:SqlDataSource>
               
                <cc1:CollectionPager ID="clPager" runat="server" BackText="« Tr&#432;&#7899;c" 
                                FirstText="&#272;&#7847;u" LabelText="Trang:" LastText="Cu&#7889;i" NextText="Sau »" 
                                ResultsFormat="Hi&#7875;n th&#7883; {0}-{1} (of {2})" > </cc1:CollectionPager>
            </p>
        </td>
    </tr>

</asp:Content>
